//
//  DecoPlanner4.h
//  DiveCalcTestHarness
//
//  Created by Donald MacKay on 11-04-25.
//  Copyright 2011 H2O Worx. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Utilities.h"

/**
 * Helper Class. This class bundles up all the necessary information to 
 *  to calculate a decompression for the various phases of a dive:
 *      Descent
 *      Bottom Time
 *      Ascent
 *
 *  Created 2011/04/29 Dan MacKay
 *
 *  Revision History:
 */
@interface DivePhaseParameters : NSObject {
    NSNumber *startDepth;
    NSNumber *endDepth;
    NSNumber *ambientATA;
    NSNumber *ambientATAMinusWVP;
    NSNumber *waterVaporPressure;
    NSNumber *descentRate;
    NSNumber *time;
@private    
}
@property (nonatomic, retain) NSNumber *startDepth;
@property (nonatomic, retain) NSNumber *endDepth;
@property (nonatomic, retain) NSNumber *ambientATA;
@property (nonatomic, retain) NSNumber *ambientATAMinusWVP;
@property (nonatomic, retain) NSNumber *waterVaporPressure;
@property (nonatomic, retain) NSNumber *descentRate;
@property (nonatomic, retain) NSNumber *time;

-(id) initWithStartDepth:(double) sDepth endDepth:(double) eDepth
              ambientATA:(double)  aATA waterVaporPressure:(double) waterVP
             descentRate: (double) dRate Time:(double) t;

@end
/**
 * Helper Class. Tissue simply contains two properties that model 
 *  the N2 and He content of a compartment and is updated as the
 *  the dive progresses
 */
@interface Tissue : NSObject {
    double n2TissuePressure;
    double heTissuePressure;
    double totalPressure;
    @private
}

@property (readwrite) double n2TissuePressure;
@property (readwrite) double heTissuePressure;
@property (readwrite) double totalPressure;

-(id) initTissueWithPPN2:(double) ppN2 andPPHe:(double) ppHe;
-(void) makeTotal;

@end

/**
 *  DecoPlanner Class. This class used to produce decompression profiles
 *      based on the provide input.
 *
 *  Created: 25/04/2011 by Dan MacKay (DBM)
 *
 *  Revision History: 25/04/2011 DBM
 *          Added the helper class Tissue to hold compartment tissue
 *          pressure values. Sixteen of these should be initialized at the 
 *          beginning of the dive and place in the The compartmentArray.
 */

@interface DecoPlanner4 : NSObject {
    NSMutableDictionary *diveProfile;
    NSMutableArray *compartmentArray;
@private
    
}

@property (nonatomic, retain) NSMutableDictionary *diveProfile;
@property (nonatomic, retain) NSMutableArray *compartmentArray;

-(void) calcDescentWithDiveParameters: (DivePhaseParameters *) diveParams andGasMix:(GasMix *) mix;
-(void) calcBottomTimeWithDiveParameters: (DivePhaseParameters *) diveParams andGasMix:(GasMix *) mix;
-(double) findLeadingCompartment: (double) adjustATAValue;

@end
